<%-- 
    Document   : ghost
    Created on : 21.11.2012, 12:11:20
    Author     : Q.90, Jan Vyhnánek
--%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page import="java.util.Locale" %>

<fmt:bundle basename="StripesResources" /> 
<fmt:message key='admin.ghostEdit' var="title"/>
<s:layout-render name="layout.jsp" nadpis="${title}">
    <s:layout-component name="telo">
        <s:useActionBean beanclass="cz.muni.fi.pa165.hauntedhouses.rest.web.GhostsActionBean" var="actionBean"/>
        <center>
            <s:form style="width:400px" beanclass="cz.muni.fi.pa165.hauntedhouses.rest.web.GhostsActionBean">
                <s:hidden name="ghost.id"/>
                <fieldset><legend><fmt:message key="admin.changeEntries"/></legend>
                    <%@include file="ghostform.jsp"%>
                    <s:submit name="save"><fmt:message key="save"/></s:submit>
                    <s:submit name="storno"><fmt:message key="storno"/></s:submit>
                    </fieldset>
            </s:form>

            <s:form style="width:400px" beanclass="cz.muni.fi.pa165.hauntedhouses.rest.web.GhostsActionBean">
                <s:hidden name="ghost.id"/>
                <fieldset><legend><fmt:message key="admin.selectAbility"/></legend>
                    <c:choose>
                        <c:when test="${fn:length(actionBean.abilities) == 0}">
                            <div><font style="color: red;"><fmt:message key="menu.noabilities"/></font></div>
                        </c:when>
                        <c:otherwise>
                            <c:set var="list" value="${actionBean.abilities}"/>  
                            <s:select name="selectedAbility">  
                                <s:options-collection collection="${list}" label="name" value="id"/> 
                            </s:select>
                            <s:submit name="addAbilityToGhost"><fmt:message key="admin.select"/></s:submit>
                        </c:otherwise>
                    </c:choose>
                </fieldset>
            </s:form>
        </center>
    </s:layout-component>
</s:layout-render>
